<?php

interface Displayable {
    function display();
}
    
class Classname implements Displayable {

    private $attribute;

    public function __construct($param) {
        echo "Constructor called with parameter ".$param."<br />";
    }

    public function __get($name) {
        if (isset($this->$name)) {
            return $this->$name;
        } else {
            return null;
        }
    }

    public function __set($name, $value) {
        $this->$name = $value;
    }

    public function operation1($param) {
        $this->attribute = $param;
        echo $this->attribute;
        echo '<br />';
    }

    public function operation2($param1, $param2) {

    }

    public function display() {
        echo 'nothing<br />';
    }

    public function __destruct() {
        echo "this object is ended.<br />";
    }
}

$cn = new Classname('hello');
$cn->operation1('michael');
// echo $cn->attribute;
$cn->name = 'jason';
echo $cn->name;
echo $cn->age;
$cn->display();
$cn = null;
